package com.example.imageandvideo.template

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.example.imageandvideo.R
import com.example.imageandvideo.adapter.NineImageAdapter
import com.example.imageandvideo.base.BaseRecyclerViewTemplate
import com.example.imageandvideo.bean.NineImageBean

/**
 *
 * @Package: com.example.imageandvideo.template
 * @ClassName: NineImageTemplate
 * @Author: szj
 * @CreateDate: 6/24/21 2:51 PM
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
class NineImageTemplate(val list: MutableList<NineImageBean>) : BaseRecyclerViewTemplate() {

    private lateinit var adapter: NineImageAdapter
    override fun buildAdapter(): BaseQuickAdapter<*, *> {
        adapter = NineImageAdapter(list)
        return adapter
    }

    override fun getAdapter(): RecyclerView.Adapter<*> = adapter

    //管理器
    override fun buildLayoutManager(context: Context?): RecyclerView.LayoutManager =
        GridLayoutManager(context, 3)

    //头布局
    override fun headView(context: Context?): View? =
        LayoutInflater.from(context).inflate(R.layout.nine_image_head_layout, null)

    //尾布局
    override fun bottomView(context: Context?): View? =
        LayoutInflater.from(context).inflate(R.layout.nine_image_bottom_layout, null)

}